﻿using AutoMapper;
using Jst.Application.Contracts.IApplication.Users;
using Jst.Application.Contracts.IApplication.Users.Vos;
using Jst.Domain.Entities;
using Jst.IRepository.Repositories;
using SqlSugar;

namespace Jst.Application.Users
{
    public class UserAppService : IUserAppService
    {
        private readonly IRepository<users> _userRepo;
        private readonly IMapper _mapper;
        private readonly ISqlSugarClient _db;

        public UserAppService(ISqlSugarClient db, IRepository<users> userRepo, IMapper mapper)
        {
            _db = db;
            _userRepo = userRepo;
            _mapper = mapper;
        }

        public async Task<UserVo> GetAsync(long id)
        {
            var user = await _userRepo.GetAsync(id);
            return _mapper.Map<UserVo>(user);
        }
    }
}